package com.tsy.server.system.entity.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

/**
 * 用户注册请求参数
 */
@Data
@ApiModel(value = "用户注册请求参数", description = "用户注册时需要提交的信息")
public class UserRegisterDTO {

    /**
     * 用户名
     */
    @ApiModelProperty(value = "用户名", required = true, example = "zhangsan", notes = "用户名长度必须在4-20个字符之间，只能包含字母、数字和下划线")
    @NotBlank(message = "用户名不能为空")
    @Size(min = 4, max = 20, message = "用户名长度必须在4-20个字符之间")
    @Pattern(regexp = "^[a-zA-Z0-9_]+$", message = "用户名只能包含字母、数字和下划线")
    private String username;

    /**
     * 密码
     */
    @ApiModelProperty(value = "密码", required = true, example = "123456", notes = "密码长度必须在6-20个字符之间")
    @NotBlank(message = "密码不能为空")
    @Size(min = 6, max = 20, message = "密码长度必须在6-20个字符之间")
    private String password;

    /**
     * 确认密码
     */
    @ApiModelProperty(value = "确认密码", required = true, example = "123456", notes = "必须与密码一致")
    @NotBlank(message = "确认密码不能为空")
    private String confirmPassword;

    /**
     * 邮箱
     */
    @ApiModelProperty(value = "邮箱", required = true, example = "zhangsan@qq.com", notes = "请输入有效的邮箱地址")
    @NotBlank(message = "邮箱不能为空")
    @Email(message = "邮箱格式不正确")
    private String email;

    /**
     * 验证码
     */
    @ApiModelProperty(value = "验证码", required = true, example = "123456", notes = "验证码长度必须为6位")
    @NotBlank(message = "验证码不能为空")
    @Size(min = 6, max = 6, message = "验证码长度必须为6位")
    private String verificationCode;

    /**
     * 昵称
     */
    @ApiModelProperty(value = "昵称", required = false, example = "张三", notes = "昵称长度不能超过20个字符")
    @Size(max = 20, message = "昵称长度不能超过20个字符")
    private String nickname;
}